﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true"
    CodeFile="UsersList.aspx.cs" Inherits="UserManage_UsersList" Title="用户信息列表" Culture="auto"
    meta:resourcekey="PageResource2" UICulture="auto" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="title">
        <asp:Label ID="lblUserList" runat="server" Text="用户信息列表" meta:resourcekey="lblUserListResource1"></asp:Label></div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table class="add_table" cellspacing="1" cellpadding="3" style="width: 70%" >
                <tr>
                    <td align="right">
                        <asp:DropDownList ID="ddlColumnName" runat="server" meta:resourcekey="ddlColumnNameResource1">
                            <asp:ListItem Text="登录名" Value="LoginID" meta:resourcekey="ListItemResourceLoginID"></asp:ListItem>
                            <asp:ListItem Text="用户名" Value="UserName" meta:resourcekey="ListItemResource3"></asp:ListItem>
                            <asp:ListItem Text="电子信箱" Value="Email" meta:resourcekey="ListItemResource4"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td>
                        <asp:TextBox ID="txtloginName" runat="server" meta:resourcekey="txtloginNameResource1"></asp:TextBox>
                    </td>
                    <td align="right">
                        <asp:Label ID="lblCompany" runat="server" Text="所属公司：" meta:resourcekey="lblCompanyResource1"></asp:Label>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlCompany" runat="server">
                        </asp:DropDownList>
                        <cc1:ListSearchExtender ID="ListSearchExtender2" runat="server" TargetControlID="ddlCompany"
                            PromptCssClass="ListSearchExtenderPrompt" Enabled="True">
                        </cc1:ListSearchExtender>
                    </td>
                    <td>
                        <asp:Button ID="btnSearch" runat="server" Text="搜索" class="btn" OnClick="btnSearch_Click"
                            ValidationGroup="SeaG" meta:resourcekey="btnSearchResource1" />
                    </td>
                </tr>
            </table>
            <div class="list_title">
                <div class="autoleft">
                    <asp:Label ID="lblTotal" runat="server" meta:resourcekey="lblTotalResource1"></asp:Label>
                    <asp:Label ID="lblTotalRecord" runat="server" Text="条记录" meta:resourcekey="lblTotalRecordResource1"></asp:Label>&nbsp;<a
                        href="UserAdd.aspx"><asp:Label ID="lblUserAdd" runat="server" Text="添加用户" meta:resourcekey="lblUserAddResource1"></asp:Label></a></div>
                <div class="autoright">
                    <asp:Label ID="lblPerPageDisplay" runat="server" Text="每页显示：" meta:resourcekey="lblPerPageDisplayResource1"></asp:Label>
                    <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged"
                        meta:resourcekey="ddlPagesResource1">
                        <asp:ListItem Selected="True" Text="10" Value="10" meta:resourcekey="ListItemResource1"></asp:ListItem>
                        <asp:ListItem Text="15" Value="15" meta:resourcekey="ListItemResource2"></asp:ListItem>
                    </asp:DropDownList>
                </div>
            </div>
            <asp:GridView ID="gvUserList" runat="server" AllowPaging="True" PageSize="10" AutoGenerateColumns="False"
                Width="100%" OnPageIndexChanging="gvUserList_PageIndexChanging" OnRowCommand="gvUserList_RowCommand"
                OnSorting="gvUserList_Sorting" AllowSorting="True" OnRowDataBound="gvUserList_RowDataBound"
                meta:resourcekey="gvUserListResource1">
                <PagerTemplate>
                    <table style="width: 100%">
                        <tr>
                            <td>
                                <asp:Label ID="lblCurrentPage" runat="server" Text="页次:" meta:resourcekey="lblCurrentPageResource1"></asp:Label>&nbsp;<asp:Label
                                    ID="Label1" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1 %>'
                                    meta:resourcekey="Label1Resource1"></asp:Label>/<asp:Label ID="Label2" runat="server"
                                        Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' meta:resourcekey="Label2Resource1"></asp:Label>&nbsp;
                                <asp:Label ID="lblTotalPage" runat="server" Text="总计" meta:resourcekey="lblTotalPageResource1"></asp:Label>&nbsp;<asp:Label
                                    ID="Label3" runat="server" Text="<%# ((System.Data.DataView)gvUserList.DataSource).Count %>"
                                    meta:resourcekey="Label3Resource1"></asp:Label>
                            </td>
                            <td align="right">
                                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Page" CommandArgument="First"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" Text="首页" meta:resourcekey="LinkButton1Resource1"></asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument="Prev" CommandName="Page"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>" Text="前页" meta:resourcekey="LinkButton2Resource1"></asp:LinkButton>
                                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Page" CommandArgument="Next"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>"
                                    Text="后页" meta:resourcekey="LinkButton3Resource1"></asp:LinkButton>
                                <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument="Last" CommandName="Page"
                                    Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>"
                                    Text="尾页" meta:resourcekey="LinkButton4Resource1"></asp:LinkButton>&nbsp;
                                <asp:Label ID="lblTurnOn" runat="server" Text="转第" meta:resourcekey="lblTurnOnResource1"></asp:Label>
                                <asp:TextBox ID="txtPages" runat="server" Width="35px" meta:resourcekey="txtPagesResource1"></asp:TextBox>
                                <asp:Label ID="lblPages2" runat="server" Text="页" meta:resourcekey="lblPages2Resource1"></asp:Label>
                                <asp:LinkButton ID="lbtnGo" runat="server" Text="提交" OnClick="lbtnGo_Click" meta:resourcekey="lbtnGoResource1"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </PagerTemplate>
                <Columns>
                    <asp:TemplateField HeaderText="登录名" SortExpression="LoginID" meta:resourcekey="TemplateFieldResource1">
                        <ItemTemplate>
                            <asp:Label ID="lblLoginName" runat="server" Text='<%# Eval("LoginID") %>' meta:resourcekey="lblLoginNameResource2"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="用户名" SortExpression="UserName" meta:resourcekey="TemplateFieldResource2">
                        <ItemTemplate>
                            <asp:Label ID="lblUserName" runat="server" Text='<%# Eval("UserName") %>' meta:resourcekey="lblUserNameResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="E-mail" SortExpression="Email">
                        <ItemTemplate>
                            <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>' meta:resourcekey="lblEmailReosurce1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="5%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="所属公司" SortExpression="ClientID" meta:resourcekey="TemplateFieldResourceCompany">
                        <ItemTemplate>
                            <asp:Label ID="lblClientID" runat="server" Text='<%# GetClient(Eval("ClientID")) %>' meta:resourcekey="lblClientIDReosurce1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="用户所属角色" SortExpression="Roles" meta:resourcekey="TemplateFieldResource3">
                        <ItemTemplate>
                            <asp:Label ID="lblRoleName" runat="server" Text='<%# GetRoles( Eval("Roles")) %>'
                                meta:resourcekey="lblRoleNameResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="40%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="状态" SortExpression="IsActivity" meta:resourcekey="TemplateFieldResource4">
                        <ItemTemplate>
                            <asp:HiddenField ID="hidStatus" runat="server" Value='<%# Eval("IsActivity") %>' />
                            <asp:Label ID="lblStaus" runat="server" Text='<%# HK2009.Common.StringUtil.GetStatus(Eval("IsActivity")) %>'
                                meta:resourcekey="lblStausResource1"></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="10%" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作" meta:resourcekey="TemplateFieldResource5">
                        <ItemTemplate>
                            <asp:LinkButton ID="lkbtnEdit" runat="server" CommandName="Action" CausesValidation="False"
                                CommandArgument='<%# Eval("UserID") %>' Text="修改状态" OnClientClick="javascript:return confirm('确定要修改该用户状态？');"
                                meta:resourcekey="lkbtnEditResource1"></asp:LinkButton>
                            &nbsp; <a href='UserUpdate.aspx?UserID=<%# Eval("UserID") %>'>
                                <asp:Label ID="lblUpdate" runat="server" Text="修改" meta:resourcekey="lblUpdateResource1"></asp:Label></a>
                            <asp:LinkButton ID="lbtnDel" runat="server" Text="删除" CommandArgument='<%# Eval("UserID") %>'
                                OnClientClick="javascript:return confirm('确定要删除该用户？');" CommandName="Del" meta:resourcekey="lbtnDelResource1"></asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle Width="20%" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle HorizontalAlign="Center" />
                <RowStyle HorizontalAlign="Center" />
            </asp:GridView>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
